package com.turing.post.report.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 发卡机构激活、授信额度账务日结表
 * 
 * @author kangzhe
 * 
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "CreditDaySettlement")
@IdClass(CreditDaySettlement.class)
public class CreditDaySettlement implements Serializable {
	public CreditDaySettlement() {
		super();
	}

	/**
	 * 发卡机构号
	 */
	private String issueBranchNo;
	/**
	 * 账务日期
	 */
	private Date tranDate;
	/**
	 * 上日余额
	 */
	private BigInteger lastBalance;
	/**
	 * 发放额度
	 */
	private BigInteger deliver;
	/**
	 * 激活额度
	 */
	private BigInteger activate;
	/**
	 * 卡内扣手续费
	 */
	private BigInteger cardFee;
	/**
	 * 现金手续费
	 */
	private BigInteger cashFee;
	/**
	 * 授信额度
	 */
	private BigInteger credit;
	/**
	 * 本日余额
	 */
	private BigInteger balance;
	/**
	 * 本日增加资金
	 */
	private BigInteger capitalDeposit;

	@Id
	@Column(name = "ISSUEBRANCHNO", nullable = false)
	public String getIssueBranchNo() {
		return issueBranchNo;
	}

	public void setIssueBranchNo(String issueBranchNo) {
		this.issueBranchNo = issueBranchNo;
	}

	@Id
	@Column(name = "TRANDATE", nullable = false)
	public Date getTranDate() {
		return tranDate;
	}

	public void setTranDate(Date tranDate) {
		this.tranDate = tranDate;
	}

	@Column(name = "LASTBALANCE", nullable = false)
	public BigInteger getLastBalance() {
		return lastBalance;
	}

	public void setLastBalance(BigInteger lastBalance) {
		this.lastBalance = lastBalance;
	}

	@Column(name = "DELIVER", nullable = false)
	public BigInteger getDeliver() {
		return deliver;
	}

	public void setDeliver(BigInteger deliver) {
		this.deliver = deliver;
	}

	@Column(name = "ACTIVATE", nullable = false)
	public BigInteger getActivate() {
		return activate;
	}

	public void setActivate(BigInteger activate) {
		this.activate = activate;
	}

	@Column(name = "CREDIT", nullable = false)
	public BigInteger getCredit() {
		return credit;
	}

	public void setCredit(BigInteger credit) {
		this.credit = credit;
	}

	@Column(name = "BALANCE", nullable = false)
	public BigInteger getBalance() {
		return balance;
	}

	public void setBalance(BigInteger balance) {
		this.balance = balance;
	}
	
	@Override
	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] {
				getIssueBranchNo(), getTranDate()
				 });
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof CreditDaySettlement))
			return false;

		CreditDaySettlement other = (CreditDaySettlement) obj;

		if (!PCPSUtil.compareObject(this.getIssueBranchNo(), other
				.getIssueBranchNo()))
			return false;

		return PCPSUtil.compareObject(this.getTranDate(), other.getTranDate());
	}

	@Column(name = "CAPITALDEPOSIT", nullable = false)
	public BigInteger getCapitalDeposit() {
		return capitalDeposit;
	}

	public void setCapitalDeposit(BigInteger capitalDeposit) {
		this.capitalDeposit = capitalDeposit;
	}

	@Column(name = "CARDFEE", nullable = false)
	public BigInteger getCardFee() {
		return cardFee;
	}

	public void setCardFee(BigInteger cardFee) {
		this.cardFee = cardFee;
	}

	@Column(name = "CASHFEE", nullable = false)
	public BigInteger getCashFee() {
		return cashFee;
	}

	public void setCashFee(BigInteger cashFee) {
		this.cashFee = cashFee;
	}
}
